/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package calibracaolion;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Santi
 */
@Entity
@Table(name = "localizacoes", catalog = "geins", schema = "")
@NamedQueries({
    @NamedQuery(name = "Localizacoes.findAll", query = "SELECT l FROM Localizacoes l"),
    @NamedQuery(name = "Localizacoes.findByCodLocal", query = "SELECT l FROM Localizacoes l WHERE l.codLocal = :codLocal"),
    @NamedQuery(name = "Localizacoes.findByLocal", query = "SELECT l FROM Localizacoes l WHERE l.local = :local")})
public class Localizacoes implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod_local")
    private Integer codLocal;
    @Basic(optional = false)
    @Column(name = "local")
    private String local;
    @OneToMany(mappedBy = "codLocal")
    private List<Instrumentos> instrumentosList;

    public Localizacoes() {
    }

    public Localizacoes(Integer codLocal) {
        this.codLocal = codLocal;
    }

    public Localizacoes(Integer codLocal, String local) {
        this.codLocal = codLocal;
        this.local = local;
    }

    public Integer getCodLocal() {
        return codLocal;
    }

    public void setCodLocal(Integer codLocal) {
        Integer oldCodLocal = this.codLocal;
        this.codLocal = codLocal;
        changeSupport.firePropertyChange("codLocal", oldCodLocal, codLocal);
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        String oldLocal = this.local;
        this.local = local;
        changeSupport.firePropertyChange("local", oldLocal, local);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codLocal != null ? codLocal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Localizacoes)) {
            return false;
        }
        Localizacoes other = (Localizacoes) object;
        if ((this.codLocal == null && other.codLocal != null) || (this.codLocal != null && !this.codLocal.equals(other.codLocal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "calibracaolion.Localizacoes[codLocal=" + codLocal + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
